<html>
<head><meta charset="utf-8"><title>Help debugging codegen test failures on LLVM HEAD? · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html">Help debugging codegen test failures on LLVM HEAD?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="243947273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243947273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243947273">(Jun 25 2021 at 17:39)</a>:</h4>
<p>Howdy! I'm working on getting rustc HEAD working with LLVM HEAD - the compiler builds (and has for a little over a month), but some codegen tests fail (examples <a href="https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/2719#e3b5666e-b1b7-4916-bd0f-f85b84a0af2b">here</a> if you want to look) in a way that my local LLVM experts suggest is an optimizer bug. Is there any prior art on getting the un-optimized LLVM IR and running it through the <code>llc</code> tool to bisect where the regression hit? This won't be easy to bisect otherwise because of LLVM API changes making life more complicated.</p>



<a name="243947791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243947791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243947791">(Jun 25 2021 at 17:44)</a>:</h4>
<p>there's some discussion here: <a href="https://rustc-dev-guide.rust-lang.org/backend/debugging.html">https://rustc-dev-guide.rust-lang.org/backend/debugging.html</a></p>



<a name="243947843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243947843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243947843">(Jun 25 2021 at 17:44)</a>:</h4>
<p>once you have IR and you can reproduce it with llc/opt, then bugpoint can probably narrow it down</p>



<a name="243948046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243948046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243948046">(Jun 25 2021 at 17:46)</a>:</h4>
<p>also, bytecode is more stable than textual IR when you're trying to bisect LLVM</p>



<a name="243948379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243948379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243948379">(Jun 25 2021 at 17:49)</a>:</h4>
<p>Is there an easy way to get a list of passes that rustc does that I can pass into <code>llc</code> somehow?</p>



<a name="243948530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243948530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243948530">(Jun 25 2021 at 17:50)</a>:</h4>
<p>I think <code>-Z print-llvm-passes</code> will do that.</p>



<a name="243949725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243949725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243949725">(Jun 25 2021 at 17:59)</a>:</h4>
<p>So in the case of <code>src/test/codegen/vec-iter-collect-len.rs</code> I'm looking at the results of the optimizer, so it sounds like I want the <code>opt</code> binary on the results of a compile using <code>--emit=llvm-ir -O -C no-prepopulate-passes</code>, probably <code>opt -S -O2</code>? Does that sound vaguely plausible?</p>
<p>(I'm exploring this, but if I'm wrong it'd be helpful to cut off the exploration early.)</p>



<a name="243949830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243949830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243949830">(Jun 25 2021 at 18:00)</a>:</h4>
<p>yeah that's plausible</p>



<a name="243949906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243949906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243949906">(Jun 25 2021 at 18:01)</a>:</h4>
<p>Thanks, I'll see if I've got it from here. Hopefully it can reduce down to a <code>git bisect</code> script that my machine can chew on.</p>



<a name="243952648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243952648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243952648">(Jun 25 2021 at 18:25)</a>:</h4>
<p>Well this is interesting: the test also fails on the merge-base for LLVM HEAD and the stack of patches Rust has over top of LLVM 12.</p>



<a name="243957758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243957758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243957758">(Jun 25 2021 at 19:10)</a>:</h4>
<p>alloc-optimization can't possibly succeed either as it relies on the patch that we historically have carried in-fork.</p>



<a name="243957835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243957835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243957835">(Jun 25 2021 at 19:11)</a>:</h4>
<p>Ah. Should we figure out some way to mark tests that depend on in-fork patches so it's easier to detect real failures against upstream LLVM HEAD?</p>



<a name="243957860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243957860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243957860">(Jun 25 2021 at 19:11)</a>:</h4>
<p>Yes. One way to do that is to pretend LLVM is a system llvm build not a not-system one.</p>



<a name="243957956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243957956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243957956">(Jun 25 2021 at 19:12)</a>:</h4>
<p>Ah, that sounds like what I want!</p>



<a name="243957972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243957972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243957972">(Jun 25 2021 at 19:12)</a>:</h4>
<p>(which would involve building LLVM separately and then directing the x.py to the separately built LLVM's llvm-config or whatever its called)</p>



<a name="243958084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243958084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243958084">(Jun 25 2021 at 19:13)</a>:</h4>
<p>Okay, I'll see about reworking my scripts to do that and see where we end up. Thanks!</p>



<a name="243958099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243958099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243958099">(Jun 25 2021 at 19:13)</a>:</h4>
<p>As for passes, you can specify arbitrary commands for LLVM via <code>-Cllvm-args</code> including <code>-debug-pass=Arguments</code>.</p>



<a name="243973659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243973659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243973659">(Jun 25 2021 at 21:33)</a>:</h4>
<p>didn't we find that the alloc patch was broken anyway?</p>



<a name="243973662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243973662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243973662">(Jun 25 2021 at 21:33)</a>:</h4>
<p><a href="https://github.com/rust-lang/llvm-project/pull/89">https://github.com/rust-lang/llvm-project/pull/89</a></p>



<a name="243974921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/243974921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#243974921">(Jun 25 2021 at 21:47)</a>:</h4>
<p>It may be broken, but it works! (as evidenced by the codegen tests)</p>



<a name="247435091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Help%20debugging%20codegen%20test%20failures%20on%20LLVM%20HEAD%3F/near/247435091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Help.20debugging.20codegen.20test.20failures.20on.20LLVM.20HEAD.3F.html#247435091">(Jul 28 2021 at 08:45)</a>:</h4>
<p>FWIW, just forked further discussion of that patch into <a class="stream-topic" data-stream-id="131828" href="/#narrow/stream/131828-t-compiler/topic/upstreaming.20LLVM.20patch.20for.20__rust_.20alloc.20functions">#t-compiler &gt; upstreaming LLVM patch for __rust_ alloc functions</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>